package com.fufan.mtsaas.modules.newtech.xjsreviewmedicaltechnologytracking.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.fufan.mtsaas.modules.common.bo.response.RequestPojo;
import com.fufan.mtsaas.modules.common.bo.response.ResStatus;
import com.fufan.mtsaas.modules.common.bo.response.Result;
import com.fufan.mtsaas.modules.newtech.xjsreviewmedicaltechnology.bo.response.XjsReviewMedicalTechnologyResponse;
import com.fufan.mtsaas.modules.newtech.xjsreviewmedicaltechnologytracking.bo.request.XjsReviewMedicalTechnologyTrackingQueryRequest;
import com.fufan.mtsaas.modules.newtech.xjsreviewmedicaltechnologytracking.bo.request.XjsReviewMedicalTechnologyTrackingSaveRequest;
import com.fufan.mtsaas.modules.newtech.xjsreviewmedicaltechnologytracking.bo.response.XjsReviewMedicalTechnologyTrackingResponse;
import com.fufan.mtsaas.modules.newtech.xjsreviewmedicaltechnologytracking.dao.XjsReviewMedicalTechnologyTrackingDao;
import com.fufan.mtsaas.modules.newtech.xjsreviewmedicaltechnologytracking.model.XjsReviewMedicalTechnologyTracking;
import com.fufan.mtsaas.modules.newtech.xjsreviewmedicaltechnologytracking.service.XjsReviewMedicalTechnologyTrackingService;
import com.fufan.mtsaas.util.ParamUtil;
import com.github.pagehelper.ISelect;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 2023年度医疗技术跟踪评估表(XjsReviewMedicalTechnologyTracking)表服务实现类
 *
 * @author Liby
 * @since 2025-01-05 19:47:09
 */
@Service("xjsReviewMedicalTechnologyTrackingServiceImpl")
@Primary
@Slf4j
public class XjsReviewMedicalTechnologyTrackingServiceImpl
        extends ServiceImpl<XjsReviewMedicalTechnologyTrackingDao, XjsReviewMedicalTechnologyTracking> implements XjsReviewMedicalTechnologyTrackingService {
    @Resource
    private XjsReviewMedicalTechnologyTrackingDao XjsReviewMedicalTechnologyTrackingDao;

    @Override
    public Result doQueryPage(XjsReviewMedicalTechnologyTrackingQueryRequest map) {
        Result<XjsReviewMedicalTechnologyTrackingResponse> result = new Result<>();
        Page<XjsReviewMedicalTechnologyTrackingResponse> page = new Page<>();
        long total = com.github.pagehelper.PageHelper.count(new ISelect() {
            @Override
            public void doSelect() {
                XjsReviewMedicalTechnologyTrackingDao.selectByPage(page, map);
            }
        });


        // 分页
        ParamUtil.setPage(map.getPageSize(), map.getCurrentPage(), page);
        //分页查询
        List<XjsReviewMedicalTechnologyTrackingResponse> list = XjsReviewMedicalTechnologyTrackingDao.selectByPage(page,map);

        page.setRecords(list);
        page.setTotal((int) total);
        result.setResStatus(ResStatus.STATUS_SUCCESS);
        result.setResMsg(ResStatus.STATUS_SUCCESS_MSG);
        result.setResData(page);
        return result;
    }

    @Override
    public Result doSave(XjsReviewMedicalTechnologyTrackingSaveRequest entity, RequestPojo requestPojo) {
        return null;
    }

    @Override
    public Result doUpdate(XjsReviewMedicalTechnologyTrackingSaveRequest entity, RequestPojo requestPojo) {
        return null;
    }

    @Override
    public Result doDelete(XjsReviewMedicalTechnologyTrackingQueryRequest map, RequestPojo requestPojo) {
        return null;
    }
}
